libxc: osdep: convert xc_evtchn_bind_virq()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrlosdep.h

index 25c665eaa47cb919c8d7d62d9a00d0efa00a121a..fadb00cca77504ff2f62cd09d560ba1ea983d00f 100644 (file)
@@ -101,6 +101,12 @@ xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
     return xce->ops->u.evtchn.bind_interdomain(xce, xce->ops_handle, domid, remote_port);
 }
 
+evtchn_port_or_error_t
+xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
+{
+    return xce->ops->u.evtchn.bind_virq(xce, xce->ops_handle, virq);
+}
+
 /*
  * Local variables:
  * mode: C
index 231f3fb6a239a60084c19f88864b47c3b0ad4dc2..bc5cc279fc5b93b2c88ce9a1395719b41997dea9 100644 (file)
@@ -399,14 +399,15 @@ linux_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
     return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
+static evtchn_port_or_error_t
+linux_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_virq bind;
 
     bind.virq = virq;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
 int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
@@ -443,6 +444,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
         .notify = &linux_evtchn_notify,
         .bind_unbound_port = &linux_evtchn_bind_unbound_port,
         .bind_interdomain = &linux_evtchn_bind_interdomain,
+        .bind_virq = &linux_evtchn_bind_virq,
     },
 };
 
index 631078a31d0d71588ac0270a9dbf13604faed8f8..b9587a493ef154fd77760834c52068acc355e6ff 100644 (file)
@@ -346,25 +346,26 @@ int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
     return 0;
 }
 
-evtchn_port_or_error_t xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
+static evtchn_port_or_error_t minios_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
+    int fd = (int)h;
     evtchn_port_t port;
     int i;
 
     assert(get_current() == main_thread);
-    i = port_alloc(xce->fd);
+    i = port_alloc(fd);
     if (i == -1)
        return -1;
 
     printf("xc_evtchn_bind_virq(%d)", virq);
-    port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)xce->fd);
+    port = bind_virq(virq, evtchn_handler, (void*)(intptr_t)fd);
 
     if (port < 0) {
        errno = -port;
        return -1;
     }
-    files[xce->fd].evtchn.ports[i].bound = 1;
-    files[xce->fd].evtchn.ports[i].port = port;
+    files[fd].evtchn.ports[i].bound = 1;
+    files[fd].evtchn.ports[i].port = port;
     unmask_evtchn(port);
     return port;
 }
@@ -408,6 +409,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
         .notify = &minios_evtchn_notify,
         .bind_unbound_port = &minios_evtchn_bind_unbound_port,
         .bind_interdomain = &minios_evtchn_bind_interdomain,
+        .bind_virq = &minios_evtchn_bind_virq,
     },
 };
 
index f14ad85d715dc3cef5fe059148a80c205a615409..85b4d5c3085d74b9d616d2605eabb3581ab8d44b 100644 (file)
@@ -268,15 +268,16 @@ int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
     return ioctl(xce->fd, IOCTL_EVTCHN_UNBIND, &unbind);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
+static evtchn_port_or_error_t
+netbsd_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_virq bind;
     int err;
 
     bind.virq = virq;
 
-    err = ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+    err = ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
     if (err)
        return -1;
     else
@@ -308,6 +309,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
          .notify = &netbsd_evtchn_notify,
          .bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
          .bind_interdomain = &netbsd_evtchn_bind_interdomain,
+         .bind_virq = &netbsd_evtchn_bind_virq,
     },
 };
 
index 3e704c2c7eca25f4a8f5041c6be89b5963cbbeea..2bdb985b0f83bd1cb7403c060f326b251ec59c9f 100644 (file)
@@ -241,14 +241,15 @@ solaris_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
     return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_virq(xc_evtchn *xce, unsigned int virq)
+static evtchn_port_or_error_t
+solaris_evtchn_bind_virq(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_virq bind;
 
     bind.virq = virq;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_VIRQ, &bind);
 }
 
 int xc_evtchn_unbind(xc_evtchn *xce, evtchn_port_t port)
@@ -285,6 +286,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
         .notify = &solaris_evtchn_notify,
         .bind_unbound_port = &solaris_evtchn_bind_unbound_port,
         .bind_interdomain = &solaris_evtchn_bind_interdomain,
+        .bind_virq = &solaris_evtchn_bind_virq,
     },
 };
 
index 83c79fdceb618fdd5713859ced6de80537dbf48c..1869ba2737bb2e92aa53938858c4ae0bd16c4d0c 100644 (file)
@@ -82,6 +82,7 @@ struct xc_osdep_ops
             evtchn_port_or_error_t (*bind_unbound_port)(xc_evtchn *xce, xc_osdep_handle h, int domid);
             evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid,
                                                        evtchn_port_t remote_port);
+            evtchn_port_or_error_t (*bind_virq)(xc_evtchn *xce, xc_osdep_handle h, unsigned int virq);
         } evtchn;
     } u;
 };